package org.example.springoauth2.resourceserver2.feign.factory.fallback;

import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.example.springoauth2.resourceserver2.feign.RemoteResourceServer1HomeService;
import org.example.springoauth2.securitycommon.common.ApiResp;
import org.example.springoauth2.securitycommon.entity.JdbcUser;
import org.example.springoauth2.securitycommon.entity.SysUser;

/**
 * @author hzq
 * @date 2021/10/12 13:44
 */
@Slf4j
public class RemoteResourceServer1HomeServiceImpl implements RemoteResourceServer1HomeService {

    @Setter
    private Throwable cause;

    @Override
    public ApiResp<String> info(String from) {
        log.error("远程调用失败：{}", cause.getLocalizedMessage());
        return ApiResp.ofFeignError(cause.getLocalizedMessage());
    }

    @Override
    public ApiResp<JdbcUser> user() {
        log.error("远程调用失败：{}", cause.getLocalizedMessage());
        return ApiResp.ofFeignError(cause.getLocalizedMessage());
    }
}
